1. Field
The present invention relates to encoding and decoding of a moving picture based on adaptive scanning; and, more particularly, to a moving picture encoding/decoding apparatus that can increase a compression rate by performing intra prediction onto blocks of a predetermined size, and adaptively scanning coefficients acquired from Discrete Cosine Transform (DCT) of a residue signal and quantization differently according to the intra prediction mode, and a method thereof.
2. Description of Related Art
According to an H.264 standard arranged for encoding/decoding a moving picture, the encoding/decoding is performed on the basis of a unit of macro blocks or a unit of a sub-block. One frame includes a plurality of macro blocks, and the sub-block is acquired by dividing a macro block into two or four sub-blocks. The encoding and decoding are carried out based on temporal prediction and spatial prediction. Temporal prediction is predicting motion of the macro blocks of a current frame by referring to macro blocks of adjacent frames. Spatial prediction is predicting a macro block of a current frame to be encoded based on adjacent macro blocks within the current frame.
The spatial prediction is also referred to as intra prediction. The intra predication takes advantage of a feature that adjacent pixels of a pixel to be predicted are highly likely to have values similar to a value of the pixel to be predicted. According to the H.264 standard, a pixel value of a current block is predicted based on a prediction mode considering nine directionalities.
FIG. 1 is a view showing an intra prediction mode for 4×4 blocks and 8×8 blocks in the H.264 standard. There are nine prediction modes according to the prediction direction: a vertical mode (mode 0), a horizontal mode (mode 1), a DC mode (mode 2), a Diagonal_Down_Left mode (mode 3), a Diagonal_Down_Right mode (mode 4), a Vertical_Right mode (mode 5), a Horizontal_Down mode (mode 6), a Vertical_Left mode (mode 7), and a Horizontal_Up mode (mode 8). The arrows signify prediction directions. Hereinafter, a prediction process in the vertical mode and the horizontal mode when intra prediction is performed onto 4×4 blocks will be described.
FIG. 2 is a view for describing a pixel prediction process in the vertical mode performed onto 4×4 blocks 300. As shown in FIG. 2, pixels a, e, i, and m 302, 304, 306 and 308 are predicted from an adjacent pixel A in the vertical direction. In the same way, pixels b, f, j and n are predicted from a pixel B, and pixels c, g, k and o are predicted from a pixel C, while pixels d, h, l and p are predicted from a pixel D.
FIG. 3 is a view for describing a pixel prediction process in the horizontal mode performed onto 4×4 blocks 300. As shown in FIG. 3, pixels a, b, c and d 312, 314, 316 and 318 are predicted from an adjacent pixel l in the horizontal direction. In the same way, pixels e, f, g and h are predicted from a pixel J, and pixels i, j, k and l are predicted from a pixel K, while pixels m, n, o and p are predicted from a pixel L.
Meanwhile, a conventional moving picture encoder performs entropy encoding by performing Discrete Cosine Transform (DCT) and quantization onto a residue signal, which is obtained by differentially dividing a predicted signal and a current signal, to thereby produce coefficients and performing zigzag scanning onto the coefficients.
However, the correlation of the residue signal is likely to be high in a horizontal direction or a vertical direction according to whether the prediction mode is a horizontal mode or a vertical mode. Therefore, the conventional encoding method using a fixed zigzag scanning has a drawback that it is not appropriate for acquiring a high compression rate.